class Microkernel {
    constructor() {
        this.plugins = new Map();
        this.timeDisplay = document.getElementById('time-display');
    }

    registerPlugin(name, plugin) {
        this.plugins.set(name, plugin);
        plugin.initialize(this);
    }

    updateTime() {
        const now = new Date();
        const timeString = now.toLocaleTimeString();
        this.timeDisplay.textContent = timeString;
        
        // Notify all plugins about time update
        this.plugins.forEach(plugin => {
            if (plugin.onTimeUpdate) {
                plugin.onTimeUpdate(now);
            }
        });
    }

    start() {
        // Update time every second
        setInterval(() => this.updateTime(), 1000);
        this.updateTime(); // Initial update
    }
}

// Initialize the microkernel
const kernel = new Microkernel();
window.addEventListener('DOMContentLoaded', () => {
    kernel.start();
}); 